import { createApp } from 'vue';
import { createPinia } from 'pinia'
// 按需自动引入，同时全局兜底引入 Element Plus 基础 CSS，避免个别组件样式缺失
import 'element-plus/dist/index.css'
// 引入暗黑模式样式
import 'element-plus/theme-chalk/dark/css-vars.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import App from './App.vue';
import './assets/global.less';
import components from './components/global';
import Router from './router/index';
import i18n from './plugins/i18n';

const app = createApp(App)

// components
for (const i in components) {
  app.component(i, components[i])
}

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(Router).use(createPinia()).use(i18n).mount('#app')
